<?php


namespace app\admin\controller;


use app\admin\model\Listinfo;
use app\admin\model\Share;
use app\common\controller\AdminBase;

class Life extends AdminBase
{
    protected function _initialize()
    {
        parent::_initialize();
    }

    public function index()
    {
        return $this->fetch('index');
    }

    public function getLists()
    {
        if($this->request->isAjax()) {
            $m = new Share();
            return $m->getLists();
        }
    }

    public function flag($id)
    {
        if ($this->request->isAjax()) {
            $m = new Share();     $data = input('post.');
            $res = $m->allowField(['is_show','is_top','is_index'])->save($data,['id'=>$id]); //失败返回false
            if($res !== false) $this->success('更新成功');
            else $this->error('请重试');
        }
    }
}